import {
	GetCodeData,
	GetCodeParams,
	LoginData,
	LoginParams,
	LoginPassParams,
	PatientList,
	UserData,
} from '../types/user'
import { request } from '@/utils/request'

/**
 * 发送验证码
 */
export const getCodeApi = (params: GetCodeParams) => {
	// get 方法的参数需要通过 params 来传递
	return request.get<null, GetCodeData>('/code', { params })
}

//验证码登录
export const LoginApi = (params: LoginParams) => {
	return request.post<null, LoginData>('/login', params)
}

//账号密码登录
export const LoginByPasswordApi = (params: LoginPassParams) => {
	return request.post<null, LoginData>('/login/password', params)
}

//获取个人信息
export const getUserInfoApi = () => {
	return request.get<null, UserData>('/patient/myUser')
}
